﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Printing;

namespace 提交管理平台V1
{
    public partial class frmAutoLablePrint : Form
    {
        UserInfo ui;

        public frmAutoLablePrint(UserInfo tmpui)
        {
            InitializeComponent();
            ui = tmpui;
        }

        private void btnOperate_Click(object sender, EventArgs e)
        {
            if (txtERPUserName.Text.Equals(string.Empty))
            {
                GeneralTools.ShowInfoMsg("请先设置关联的ERP用户名！");
                return;
            }
        }

        private void frmAutoLablePrint_Load(object sender, EventArgs e)
        {
            txtERPUserName.Text = ui.GetUserSetting("ERPUserName");
            LoadPrinterList();
        }

        private void LoadPrinterList()
        {
            cmbPrinters.Items.Clear();
            try
            {
                for(int i=0;i<PrinterSettings .InstalledPrinters.Count ;i++)
                {
                    cmbPrinters.Items.Add(PrinterSettings.InstalledPrinters[i]);
                }
                PrintDocument tmppd = new PrintDocument();
                cmbPrinters.Text = tmppd.PrinterSettings.PrinterName;
            }
            catch
            {

            }
        }
    }
}